<template>
	<view class="goods-item" @click="goodsDetails">
		<image class="goods-icon" :src="dataObject.image"></image>
		<text class="goods-name">{{dataObject.store_name}}</text>
		<view class="price-view">
			<text class="fuhao" v-if="dataObject.price!='0.00'">￥</text>
			<text class="price">{{dataObject.price | notBuy}}</text>
		</view>
	</view>
</template>

<script>
	export default{
		props:{
		  dataObject:{
			  type:Object,
			  default: () => {}
		  }	
		},
		data() {
			return {
				
			}
		},
		filters:{
			notBuy(price){
				if(price=="" || price=="0" || price=="0.00"){
					return "仅展示（非卖品）"
				}else{
					return price
				}
			}
		},
		methods:{
			goodsDetails(){//商品详情
		let id = this.dataObject.id || this.dataObject.pid
				wx.navigateTo({//传商品id过去
					url:"/pages/goods_details/index?id=" + id
				})
			}
		}
	}
</script>

<style lang="scss">
	.goods-item{
		width: 330upx;
		height: 480upx;
        background-color: #fff;
		border-radius: 16upx;
		box-shadow: 0px 0px 20upx 0px rgba(0,23,46,0.03);
		display: flex;
		flex-direction: column;
		margin-top: 30upx;
		overflow: hidden;
		box-sizing: border-box;
		.goods-icon{
			width: 100%;
			height: 330upx;
		}
		.goods-name{
			color: #111111;
			font-size: 30upx;
			margin: 20upx 20upx 0 20upx;
			text-overflow: -o-ellipsis-lastline;
			overflow: hidden;
			text-overflow: ellipsis;
			display: -webkit-box;
			-webkit-line-clamp: 1;
			line-clamp: 1;
			-webkit-box-orient: vertical;
		}
		.price-view{
			display: flex;
			align-items: flex-end;
			color: #FC5434;
			margin-left: 20upx;
			margin-top: 14upx;
			.fuhao{
				font-size: 22upx;
				font-weight: 600;
			}
			.price{
				font-size: 30upx;
				font-weight: 600;
			}
		}
	}
</style>
